/***
 * 登录接口处理
 */
//登录
import { reactive } from 'vue'
import { setToken, getToken } from '@/utils/plugins/auth'
import router from '@/router/index'

//import { UpdataLogin, GetCaptchaGetCode, UpdataUserLogout } from '@/api/login.js' //接口地址

export class Login {
  constructor() {
    //parameters
  }
  public config = reactive({
    //初始化值
    passwordType: 'password',
    sliderText: '拖动滑块完成验证',
    isShow: false, // 验证码模态框是否出现
    isGetCocing: false,
    codeText: '获取验证码',
    time: 59,
    timer: undefined,
    reg: /^1[0-9]{10}$/, // 手机号码匹配正则
    pas: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[@#&_-])[\da-zA-Z@#&_-]{8,}$/, //密码强度不符合
    year: '',
    status: 1,
    phone: 'admin',
    captcha: '',
    password: '000000',
    codeImg: '',
    requestId: ''
  })

  /**
   * //获取图形验证码
   */
  public getCaptchaGetCode() {
    // GetCaptchaGetCode({}, (res) => {
    //   this.config.codeImg = res.data.base64Code
    //   this.config.requestId = res.data.requestId
    // })
  }

  /**
   * 点击登录
   */
  public updataLogin() {
    console.log('点击登录~~~~')
    setToken('weroiuwejsdlfkjwer9024werjwler3')
    const rss = getToken()
    console.log(rss)
    router.push({ path: '/' }) //测试
  }

  /**
   * //退出登录
   */
  public updataUserLogout() {}
}

export const LoginClass = new Login()
